<?php



namespace app\admin\controller\payment;



use app\common\controller\Backend;



use think\Controller;

use think\Request;



/**

 * 付款类型

 *

 * @icon fa fa-circle-o

 */

class Type extends Backend

{

    

    /**

     * Payment模型对象

     */

    protected $model = null;



    public function _initialize()

    {

        parent::_initialize();

        $this->model = model('Payment');

    }

    public function selectpage()
    {
        $where=array();
        if($this->request->request("keyValue"))
        {
           
            $where = array(
              
                'id' => array('in',$this->request->request('keyValue')),
            );
        }    
      
        if(isset($_POST["paytype"]))
        {
         
            $where= array_merge($where,array(              
                'paytype' => array('=',input("param.paytype")),
            ));
        }
        
        $result=array('list'=>$this->model->where($where)->field('id,name,parentid')-> select(),'count'=>$this->model->count());        
        if(!$this->request->request("keyValue") || $this->request->request("keyValue")==0)
        {
            array_splice($result['list'], 0, 0, array(array("id"=>0,"name"=>"请选择科目","parentid"=>0))); 
        }
        return json($result);
    }

    /**

     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法

     * 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑

     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改

     */

    



}

